其他
系统高可用之健康检查和健康度量那些事
作者:vivo 互联网服务器团队-Chen Jianbo
一、前言
二、什么是健康检查
三、为什么需要做健康检查
四、如何做健康检查
check interval=3000 rise=2 fall=5 timeout=1000 type=http;
check_http_send "HEAD /check.do HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
server 127.0.0.1:8080 max_fails=3 fail_timeout=30s;
五、健康检查例子
vrrp_script check_nginx_running {
script "/usr/local/bin/check_running"(定义脚本)
interval 10(脚本执行的间隔)
weight -10(脚本执行的优先级)
}
net.ipv4.tcp_keepalive_time = 7200
net.ipv4.tcp_keepalive_intvl = 75
net.ipv4.tcp_keepalive_probes = 9
@FuncationalInterface
public class HealthIndicator {
/**
* Return an indication of health.
* @result the health for
*/
public Health health();
}
@JsonInclude(Include.NON_EMPTY)
public final class Health extends HealthComponent {
private final Status status;
private final Map<String, Object> details;
...
}
@Component
public class MyHealthIndicator implements HealthIndicator {
@Override
public Health health() {
int errorCode = check(); // perform some specific health check
if (errorCode != 0) {
return Health.down().withDetail("Error Code", errorCode).build();
}
return Health.up().build();
}
}
六、总结
END
猜你喜欢
vivo互联网技术
vivo移动互联网是基于vivo 智能手机所建立的完整移动互联网生态圈,围绕vivo大数据运营,打造包括应用、游戏、资讯、品牌、电商、内容、金融、搜索的全方位服务生态,满足海量用户的多样化需求。
点一下,代码无 Bug